package com.zline.foodraise.adapter;

import android.content.Context;
import android.view.ViewGroup;

import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.zline.foodraise.R;
import com.zline.foodraise.entity.CommentBean;
import com.zline.foodraise.util.ImageUtil;
import com.zline.foodraise.view.DynamicItemCommentItem;
import com.zline.foodraise.view.DynamicItemCommentItem_;

import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.EBean;
import org.androidannotations.annotations.RootContext;

/**
 * Created by heshantao on 15/7/6.
 * 评论列表
 */
@EBean
public class DynamicItemCommentItemAdapter extends RecyclerViewBaseAdapter<CommentBean,DynamicItemCommentItem> {
    private static final String LOG_TAG=DynamicItemCommentItemAdapter.class.getSimpleName();
    @RootContext
    Context cxt;
    @Bean
    ImageUtil imageUtil;
    DisplayImageOptions options;

    @Override
    protected DynamicItemCommentItem onCreateItemView(ViewGroup parent, int viewType) {
        return DynamicItemCommentItem_.build(cxt);
    }

    @Override
    public void onBindViewHolder(ViewWrapper<DynamicItemCommentItem> holder, int position) {
        DynamicItemCommentItem view=holder.getView();
        CommentBean commentBean=arrys.get(position);
        view.setRecyclerItemClick(itemClicked);
        if(options==null){
            options = imageUtil.
                    getDisplayImageOptions(R.mipmap.default_person_icon,
                            R.mipmap.default_person_icon, R.mipmap.default_person_icon);
        }
        view.bind(commentBean, position,parentPosition,options);

    }
}
